package com.springclould.tread.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;

@RefreshScope
@Controller
public class PageController {

    @Value("${version}")    private String version;
    @GetMapping("/")
    @CrossOrigin//支持跨域请求，因为请求使用的是一个端口，而资源又是另外一个端口
    public String get(Model model){
        model.addAttribute("version", version);
        return "view";
    }

}
